home *** CD-ROM | disk | FTP | other *** search
/ SuperHack / SuperHack CD.bin / CODING / CPP / METAKIT.ZIP / INCLUDE / K4FIELD.H < prev    next >
Encoding:
C/C++ Source or Header  |  1996-12-09  |  3.5 KB  |  108 lines

  1. //@doc      FIELD HDR CORE
  2. //@module   FIELD.H - Field declarations |
  3. //  
  4. //  This file contains the declaration of the field classes.
  5. //
  6. //@normal   Copyright <cp> 1996 Meta Four Software. All rights reserved.
  7.  
  8. #ifndef __K4FIELD_H__
  9. #define __K4FIELD_H__
  10.  
  11. #ifndef __K4CONF_H__
  12.     #error Please include "k4conf.h" before this header file
  13. #endif
  14.     
  15. /////////////////////////////////////////////////////////////////////////////
  16. // Declarations in this file
  17.     
  18.     class c4_Field;                     // data structure description
  19.  
  20. /////////////////////////////////////////////////////////////////////////////
  21. /*@class Fields form a tree describing the underlying data structure.
  22. */
  23.  
  24. class c4_Field
  25. {
  26.     int _offset;
  27.     int _width;
  28.     int _depth;
  29.     int _index;
  30.     c4_PtrArray _subFields;
  31.     c4_PtrArray _subColumns;
  32.     c4_Field* _parent;
  33.     c4_String _name;
  34.     int _nameLen;
  35.     bool _repeating;
  36.  
  37. public: 
  38. //@group Construction / destruction
  39.     //@cmember Constructs a new field.
  40.     c4_Field (const char*&, c4_Field* =0);
  41.     //@cmember Destructor.
  42.     ~c4_Field ();
  43.  
  44. //@group Structural information
  45.     //@cmember Returns true if this is the root field.
  46.     bool IsRoot() const;
  47.     //@cmember returns the field which contains this one.
  48.     c4_Field& Parent() const;
  49.     //@cmember Returns the index of this field in its parent.
  50.     int Index() const;
  51.     //@cmember Returns the nesting level of this field.
  52.     int Level() const;
  53.     //@cmember Returns the repetition degree of this field.
  54.     int Degree() const;
  55.     //@cmember Returns the enclosing repeating field.
  56.     c4_Field& FindContainer();
  57.  
  58. //@group Repeating and compound fields
  59.     //@cmember Returns the number of subfields.
  60.     int NumSubFields() const;   
  61.     //@cmember Returns the description of each subfield.
  62.     c4_Field& SubField(int) const;
  63.     //@cmember Returns true if this field contains subtables.
  64.     bool IsRepeating() const;
  65.     //@cmember Returns total number of columns in the subtables.
  66.     int NumSubColumns() const;
  67.     //@cmember Returns the description of each subtable column.
  68.     c4_Field& SubColumn(int) const;
  69.     
  70. //@group Field name and description
  71.     //@cmember Returns name of this field, default omits details.
  72.     c4_String Name(bool =false) const;
  73.     //@cmember Returns the type description of this field, if any.
  74.     c4_String Type() const;
  75.     //@cmember Returns the fully specified name of this field.
  76.     c4_String Tag() const;
  77.     //@cmember Describes the structure, can omit field names.
  78.     c4_String Description(bool =false) const;
  79.     //@cmember Finds the subfield index by name.
  80.     int FindSubField(const char*) const;
  81.     
  82. //@group Column offsets and counts
  83.     //@cmember Returns start of the first column in the table.
  84.     int Offset() const;
  85.     //@cmember Returns number of columns used in the table.
  86.     int Width() const;
  87.     //@cmember Returns depth to the table containing the data.
  88.     int Depth() const;
  89.     //@cmember Finds the field index of a given table column.
  90.     int FindIndex(int) const;
  91.     
  92. private:
  93.     c4_Field (const c4_Field&);         // not implemented
  94.     void operator= (const c4_Field&);   // not implemented
  95. };
  96.  
  97. /////////////////////////////////////////////////////////////////////////////
  98.  
  99. #if q4_INLINE
  100.     #include "k4field.inl"
  101. #endif
  102.  
  103. /////////////////////////////////////////////////////////////////////////////
  104.  
  105. #endif
  106.  
  107. // $Id: k4field.h,v 1.7 1996/12/08 11:22:30 jcw Exp $
  108.